# docker build -t registry.lazycat.cloud/appdb/datadraw:202305161 .
FROM php:7.4.3-apache

RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
    && sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list \
    && requirements="vim cron mariadb-client libwebp-dev libxpm-dev libmcrypt-dev libmcrypt4 libcurl3-dev libxml2-dev \
libmemcached-dev zlib1g-dev libc6 libstdc++6 libkrb5-3 openssl debconf libfreetype6-dev libjpeg-dev libtiff-dev \
libpng-dev git libmagickwand-dev ghostscript gsfonts libbz2-dev libonig-dev libzip-dev zip unzip" \
    && apt-get update && apt-get install -y --no-install-recommends $requirements && apt-get clean && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-install mysqli \
                              pdo_mysql \
                              gd  \
                              exif \
                              bcmath \
                              opcache \
    && docker-php-ext-enable opcache

RUN a2enmod headers && \
    a2enmod rewrite

COPY . /var/www/html

RUN chmod -R 777 /var/www/html/runtime /var/www/html/public

COPY docker-entrypoint.sh /usr/local/bin/

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENV TIMEZONE=Asia/Shanghai

ENV MYSQL_HOST=localhost
ENV MYSQL_PORT=3306
ENV MYSQL_USER=root
ENV MYSQL_PASSWORD=root
ENV MYSQL_DATABASE=test
ENV TABLE_PREFIX=sd_

EXPOSE 80

ENTRYPOINT ["docker-entrypoint.sh"]

CMD ["apache2-foreground"]